package com.ulic.customerManApplication.membermodule.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ulic.customerManApplication.membermodule.bo.SubMember;
import com.ulic.customerManApplication.membermodule.dao.SubMemberDao;
import com.ulic.customerManApplication.membermodule.service.SubMemberService;
import com.ulic.customerManApplication.membermodule.vo.SubMemberVO;
import com.ulic.customerManApplication.pager.PagerModel;
import com.ulic.customerManApplication.usermodule.bo.User;
@Component("subMemberService")
public class SubMemberServiceImpl implements SubMemberService {

	private SubMemberDao subMemberDao;
	
	public SubMemberDao getSubMemberDao() {
		return subMemberDao;
	}
    @Resource
	public void setSubMemberDao(SubMemberDao subMemberDao) {
		this.subMemberDao = subMemberDao;
	}

	@Override
	public void addSubMember(SubMember subMember) throws Exception {
		subMemberDao.insertSubMember(subMember);
	}

	@Override
	public void addSubMembers(List<SubMember> subMembers) throws Exception {
		subMemberDao.insertSubMembers(subMembers);
	}

	@Override
	public SubMember getSubMember(int id) {
		return subMemberDao.getSubMember(id);
	}

	@Override
	public PagerModel getSubMembers(int curPage) {
		return subMemberDao.getSubMembers(curPage);
	}

	@Override
	public List<SubMember> getSubMembers(User user) {
		return subMemberDao.getSubMembers(user);
	}

	@Override
	public PagerModel getSubMembers(SubMemberVO subMemberVO, int curPage) {
		return subMemberDao.getSubMembers(subMemberVO, curPage);
	}

	@Override
	public void modifySubMember(SubMember subMember) throws Exception {
		subMemberDao.updateSubMember(subMember);
	}

	@Override
	public void removeSubMember(SubMember subMember) throws Exception {
		subMemberDao.deleteSubMember(subMember);
	}
	@Override
	public List<SubMember> getSubMembers(String idCard) {
		return subMemberDao.getSubMembers(idCard);
	}
	@Override
	public List<SubMember> getSubMembersByJourId(Integer journeyLoveId) {
		// TODO Auto-generated method stub
		return subMemberDao.getSubMembersByJourId(journeyLoveId);
	}
	@Override
	public List<SubMember> getSubMemberByPhone(String phone) throws Exception{
		return subMemberDao.getSubMemberByPhone(phone);
	}
	@Override
	public SubMember getSubMemberByPhone(String phone, String journeyLoveId)
			throws Exception {
		return subMemberDao.getSubMemberByPhone(phone, journeyLoveId);
	}
	@Override
	public Map<String, Long> getMemberCountByJourId(Integer journeyLoveId,String memberType) {
		return subMemberDao.getMemberCountByJourId(journeyLoveId, memberType);
	}

}
